#include <stdio.h>
#include <stdlib.h>
#include "cmdfifo.h"

#define     DIM(x)  (sizeof(x)/sizeof(x[0]))

int proc1(char cmd, char param);
int proc2(char cmd, char param);

cmd_fifo_cmd_handle_t handle_list[]=
{
    {0, proc1},
    {1, proc2},
    {2, proc2},
};



int proc1(char cmd, char param)
{
    printf ("Proc1: %d\n", param);
    return 0;
}

int proc2(char cmd, char param)
{
    printf ("Proc2: %d\n", param);
    return 0;
}


int main(int argc, char *argv[])
{
    int count = 0;

    
    cmd_fifo_init (handle_list, DIM(handle_list));
    while(count ++ < 10)
    {
        cmd_fifo_add (0, 1);
        cmd_fifo_add (1, 2);
        cmd_fifo_add (2, 3);
        cmd_fifo_add (0, 4);

    }
        cmd_fifo_main_loop ();
    /*while(count ++ < 100)*/
    /*{*/
        /*fifo = cmd_fifo_create(handle_list, DIM(handle_list));*/
        /*if (fifo == -1)*/
        /*{*/
            /*printf ("初始化失败\n");*/
        /*}*/
        /*cmd_fifo_destroy (fifo);*/
    /*}*/

    exit (EXIT_SUCCESS);
}
